Add a write-only property ::group to be consistent with GtkRadioAction and
authorSoeren Sandmann <sandmann@daimi.au.dk>
Sat, 24 Jan 2004 16:49:31 +0000 (16:49 +0000)
committerSøren Sandmann Pedersen <ssp@src.gnome.org>
Sat, 24 Jan 2004 16:49:31 +0000 (16:49 +0000)
Sat Jan 24 17:38:48 2004  Soeren Sandmann  <sandmann@daimi.au.dk>

* gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
Add a write-only property ::group to be consistent with
GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier
Andrieu)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkradiotoolbutton.c

index 1d867858a4d15ec5a7dbaa05195ffaffcd2e8bc4..7c4ba995bf4b4e270289dbab25f1530bf6416b56 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Jan 24 17:38:48 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
+       Add a write-only property ::group to be consistent with
+       GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier
+       Andrieu)
+
 Fri Jan 23 23:46:12 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the 
index 1d867858a4d15ec5a7dbaa05195ffaffcd2e8bc4..7c4ba995bf4b4e270289dbab25f1530bf6416b56 100644 (file)
@@ -1,3 +1,10 @@
+Sat Jan 24 17:38:48 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
+       Add a write-only property ::group to be consistent with
+       GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier
+       Andrieu)
+
 Fri Jan 23 23:46:12 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the 
index 1d867858a4d15ec5a7dbaa05195ffaffcd2e8bc4..7c4ba995bf4b4e270289dbab25f1530bf6416b56 100644 (file)
@@ -1,3 +1,10 @@
+Sat Jan 24 17:38:48 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
+       Add a write-only property ::group to be consistent with
+       GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier
+       Andrieu)
+
 Fri Jan 23 23:46:12 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the 
index 1d867858a4d15ec5a7dbaa05195ffaffcd2e8bc4..7c4ba995bf4b4e270289dbab25f1530bf6416b56 100644 (file)
@@ -1,3 +1,10 @@
+Sat Jan 24 17:38:48 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
+       Add a write-only property ::group to be consistent with
+       GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier
+       Andrieu)
+
 Fri Jan 23 23:46:12 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the 
index 1d867858a4d15ec5a7dbaa05195ffaffcd2e8bc4..7c4ba995bf4b4e270289dbab25f1530bf6416b56 100644 (file)
@@ -1,3 +1,10 @@
+Sat Jan 24 17:38:48 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
+
+       * gtk/gtkradiotoolbutton.c (gtk_radio_tool_button_class_init):
+       Add a write-only property ::group to be consistent with
+       GtkRadioAction and GtkRadioButton. (#132159, Patch from Olivier
+       Andrieu)
+
 Fri Jan 23 23:46:12 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfontbutton.c (gtk_font_button_label_use_font): Don't leak the 
index 7a332039dc8ad1386cb8325051ef795da74488d8..e9fb3702a1577392432a06c4141b6948d14c053b 100644 (file)
 #include "gtkradiobutton.h"
 #include "gtkintl.h"
 
-static void gtk_radio_tool_button_init       (GtkRadioToolButton      *button);
-static void gtk_radio_tool_button_class_init (GtkRadioToolButtonClass *klass);
+enum {
+  PROP_0,
+  PROP_GROUP
+};
+
+static void gtk_radio_tool_button_init         (GtkRadioToolButton      *button);
+static void gtk_radio_tool_button_class_init   (GtkRadioToolButtonClass *klass);
+static void gtk_radio_tool_button_set_property (GObject         *object,
+                                               guint            prop_id,
+                                               const GValue    *value,
+                                               GParamSpec      *pspec);
 
 GType
 gtk_radio_tool_button_get_type (void)
@@ -57,11 +66,31 @@ gtk_radio_tool_button_get_type (void)
 static void
 gtk_radio_tool_button_class_init (GtkRadioToolButtonClass *klass)
 {
+  GObjectClass *object_class;
   GtkToolButtonClass *toolbutton_class;
 
+  object_class = (GObjectClass *)klass;
   toolbutton_class = (GtkToolButtonClass *)klass;
+
+  object_class->set_property = gtk_radio_tool_button_set_property;
   
   toolbutton_class->button_type = GTK_TYPE_RADIO_BUTTON;  
+
+  /**
+   * GtkRadioToolButton:group:
+   *
+   * Sets a new group for a radio tool button.
+   *
+   * Since: 2.4
+   */
+  g_object_class_install_property (object_class,
+                                  PROP_GROUP,
+                                  g_param_spec_object ("group",
+                                                       _("Group"),
+                                                       _("The radio tool button whose group this button belongs to."),
+                                                       GTK_TYPE_RADIO_TOOL_BUTTON,
+                                                       G_PARAM_WRITABLE));
+
 }
 
 static void
@@ -71,6 +100,37 @@ gtk_radio_tool_button_init (GtkRadioToolButton *button)
   gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (_gtk_tool_button_get_button (tool_button)), FALSE);
 }
 
+static void
+gtk_radio_tool_button_set_property (GObject         *object,
+                                   guint            prop_id,
+                                   const GValue    *value,
+                                   GParamSpec      *pspec)
+{
+  GtkRadioToolButton *button;
+
+  button = GTK_RADIO_TOOL_BUTTON (object);
+
+  switch (prop_id)
+    {
+    case PROP_GROUP:
+      {
+       GtkRadioToolButton *arg;
+       GSList *slist = NULL;
+       if (G_VALUE_HOLDS_OBJECT (value)) 
+         {
+           arg = GTK_RADIO_TOOL_BUTTON (g_value_get_object (value));
+           if (arg)
+             slist = gtk_radio_tool_button_get_group (arg);
+           gtk_radio_tool_button_set_group (button, slist);
+         }
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
 /**
  * gtk_radio_tool_button_new:
  * @group: An existing radio button group, or %NULL if you are creating a new group